package view;

import dao.OrderAndDetailSelect;
import impl.OrderAndDetailSelectImpl;
import util.InputUtil;

/**
 * @classname:OrderSerlet
 * @description:
 * @author: Mr.Z
 * @date: 2021/1/2 19:49
 * @version: 0.1
 * @since:1.8
 */
public class OrderSelect{
    private OrderSelect(){}

    public static void selectMemberOrGood(){
        System.out.println("请选择是通过商品编号查询还是会员编号查询1/2");
        int num = InputUtil.inputInt();
        if(num==1){
            System.out.println("全部商品信息如下请看好id再输入");
            GoodInfoView.showAll();
            System.out.println("请输入商品id");
            int id = InputUtil.inputInt();
            OrderAndDetailSelect orderAndDetailSelect = new OrderAndDetailSelectImpl();
            orderAndDetailSelect.selectOrderAndDetailByGoodId(id).forEach(System.out::println);
        }else if(num==2){
            System.out.println("全部会员的信息如下");
            MemberView.showAll();
            System.out.println("请输入会员id");
            int mid = InputUtil.inputInt();
            OrderAndDetailSelect orderAndDetailSelect = new OrderAndDetailSelectImpl();
            orderAndDetailSelect.selectOrderAndDetailByMember(mid).forEach(System.out::println);
        }
    }
}
